package com.it.data_tree.tree.binarySearchTree;


/**
 * @Author: Coke
 * @DateTime: 2023/04/17/21:53
 * @注释: 二叉搜索树 节点  泛型
 **/
public class BSTNode2<K, V> {
    K key;
    V value;
    BSTNode2<K, V> left;
    BSTNode2<K, V> right;
    
    public BSTNode2 (K key) {
        this.key = key;
    }
    
    public BSTNode2 (K key, V value) {
        this.key = key;
        this.value = value;
    }
    
    public BSTNode2 (K key, V value, BSTNode2<K, V> left, BSTNode2<K, V> right) {
        this.key = key;
        this.value = value;
        this.left = left;
        this.right = right;
    }
    
    public K getKey () {
        return key;
    }
    
    public void setKey (K key) {
        this.key = key;
    }
    
    public V getValue () {
        return value;
    }
    
    public void setValue (V value) {
        this.value = value;
    }
    
    public BSTNode2<K, V> getLeft () {
        return left;
    }
    
    public void setLeft (BSTNode2<K, V> left) {
        this.left = left;
    }
    
    public BSTNode2<K, V> getRight () {
        return right;
    }
    
    public void setRight (BSTNode2<K, V> right) {
        this.right = right;
    }
    
    @Override
    public String toString () {
        return "BSTNode2{" +
              "key=" + key +
              ", value=" + value +
              ", left=" + left +
              ", right=" + right +
              '}';
    }
}
